package stark.app.function.usersys;

import android.widget.TextView;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.usersys.lib.goods.bean.GoodsBean;

import org.jetbrains.annotations.NotNull;

import stark.app.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

/**
 * Author：daizhongbin on 2022/12/19
 * Email：1027154338@qq.com
 * Desc:
 */
public class GoodsAdapter extends StkProviderMultiAdapter<GoodsBean> {

    public GoodsAdapter(){
        super(1);
        addItemProvider(new ItemProvider());
    }

    private class ItemProvider extends BaseItemProvider<GoodsBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_goods;
        }

        @Override
        public void convert(@NotNull BaseViewHolder holder, GoodsBean goods) {
            TextView tvName = holder.getView(R.id.tvName);
            tvName.setText("商品名称：" + goods.getName());
            TextView tvPrice = holder.getView(R.id.tvPrice);
            tvPrice.setText("单价(分)：" + goods.getPrice());
        }
    }

}
